<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <link href="css/index.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="css/jquery.bigautocomplete.css"/>
    <script src="js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="js/DataBase.js" type="text/javascript" charset="GBK"></script>
    <script type="text/javascript" src="js/jquery.bigautocomplete.js" charset="GBK"></script>
    <script src="js/angular.min.js" type="text/javascript"></script>
    <script src="js/Utils.js" type="text/javascript"></script>
    <script>
        var index = angular.module("IndexApp", []);
        index.controller("ButtonCtrl", ['$scope', function ($scope) {
            $scope.fnOk = function () {
                var objDom = $("#content iframe");
                objDom.each(function (i) {
                    window.frames[this.id].fnOk();
                });
                if(objDom.length>0){
                    $scope.visible=false;
                }
            }
            $scope.odds = {
                odd: (new Date()).valueOf(),
                telel: 13875537638
            }
            $scope.visible=true;
            $("#search").bigAutocomplete({
                data: resultData,
                callback: function (data) {
                    if ($("#" + data.value).length > 0) {
                        if (!confirm("已经添加过了!是否进行添加?")) {
                            return;
                        }
                    }
                    $("#content").append('<iframe width="99.6%" border="0" frameborder="no" scrolling="no" height="112px" id="' + data.value + '" name="' + data.value + '" src="BaseCanvas.html?code=' + data.value + '" ><iframe>');
                }
            });
            $scope.data = selects;
            $scope.selectid = 0;
            $scope.changeType = function (id) {
                $("#content iframe").remove();
                var SelectData = DataUtils.getSelectValue(id);
                if (SelectData != null && SelectData.length > 0) {
                    for (var i = 0; i < SelectData.length; i++) {
                        $("#content").append('<iframe width="99.6%" border="0" frameborder="no" scrolling="no" height="112px" name="' + SelectData[i].id + '"  id="' + SelectData[i].id + '" src="BaseCanvas.html?code=' + SelectData[i].id + '" ><iframe>');
                    }
                }
            }
        }]);
    </script>
</head>
<body ng-app="IndexApp">
<div class="classdiv">
    <table>
    </table>
</div>
<div ng-controller="ButtonCtrl">
   
    <div id="selected" ng-show="visible">
        <select class="select" ng-change="changeType(selectid)" ng-model="selectid"
                ng-options="item.value as item.name  for item in data">
        </select>
        <input id="search" class="text"/>
        <input placeholder="此处可以选择单个图" type="button" value="完成操作" class="button gray" ng-click="fnOk()"/>
    </div>
</div>
<div>
    <div id="content">
    </div>
</div>
</body>
</html>
